'****************************************************************************'
'                                                                            '
' Copyright (C) 2010 Muhammad alaa                                           '
'                                                                            '
' This program is free software; you can redistribute it and/or modify       '
' it under the terms of the GNU General Public License as published by       '
' the Free Software Foundation; either version 2 of the License, or          '
' (at your option) any later version.                                        '
'                                                                            '
' This program is distributed in the hope that it will be useful,            '
' but WITHOUT ANY WARRANTY; without even the implied warranty of             '
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              '
' GNU General Public License for more details.                               '
'                                                                            '
' You should have received a copy of the GNU General Public License along    '
' with this program; if not, write to the Free Software Foundation, Inc.,    '
' 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.                '
'                                                                            '
'****************************************************************************'

Imports SmartVision.HResults

Namespace API

    Public NotInheritable Class ComAPI
        Private Sub New()
        End Sub

        Public Declare Function BindMoniker Lib "ole32.dll" (ByVal pmk As ICOM.IMoniker, ByVal grfOpt As UInteger, ByVal iidResult As Guid, <MarshalAs(UnmanagedType.Interface), Out()> ByRef ppvResult As Object) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CLSIDFromProgID Lib "ole32.dll" (<MarshalAs(UnmanagedType.LPTStr)> ByVal TSzProgID As String, <Out()> ByRef lpszProgID As Guid) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CLSIDFromProgIDEx Lib "ole32.dll" (<MarshalAs(UnmanagedType.LPTStr)> ByVal TSzProgID As String, <Out()> ByRef lpszProgID As Guid) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CLSIDFromString Lib "ole32.dll" (<MarshalAs(UnmanagedType.LPTStr)> ByVal lpsz As String, <Out()> ByRef lpClsid As Guid) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoAddRefServerProcess Lib "ole32.dll" () As UInteger
        Public Declare Function CoAllowSetForegroundWindow Lib "OLE32.dll" (<MarshalAs(UnmanagedType.Interface)> ByVal pUnk As Object, ByVal lpvReserved As IntPtr) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoCancelCall Lib "ole32.dll" (ByVal dwThreadId As UInteger, ByVal ulTimeout As UInteger) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoCopyProxy Lib "ole32.dll" (<MarshalAs(UnmanagedType.Interface)> ByVal pProxy As Object, <MarshalAs(UnmanagedType.Interface), Out()> ByRef ppCopy As Object) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoCreateFreeThreadedMarshaler Lib "ole32.dll" (<MarshalAs(UnmanagedType.Interface)> ByVal punkOuter As Object, <MarshalAs(UnmanagedType.Interface), Out()> ByRef ppunkMarshal As Object) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoCreateGuid Lib "ole32.dll" (<Out()> ByRef pguid As Guid) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoCreateInstance Lib "ole32.dll" (ByVal rclsid As Guid, <MarshalAs(UnmanagedType.Interface)> ByVal pUnkOuter As Object, ByVal dwClsContext As ClsCtx, ByVal riid As Guid, <MarshalAs(UnmanagedType.Interface), Out()> ByRef ppv As Object) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoCreateInstanceEx Lib "ole32.dll" (ByVal rclsid As Guid, <MarshalAs(UnmanagedType.Interface)> ByVal pUnkOuter As Object, ByVal dwClsCtx As ClsCtx, ByRef pServerInfo As CoServerInfo, ByVal dwCount As UInteger, <MarshalAs(UnmanagedType.LPArray), Out()> ByRef pResults() As MultiQI) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoDisableCallCancellation Lib "ole32.dll" (ByVal pReserved As IntPtr) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoDisconnectContext Lib "ole32.dll" (ByVal wTimeout As UInteger) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoDisconnectObject Lib "ole32.dll" (<MarshalAs(UnmanagedType.IUnknown)> ByRef pUnk As Object, ByVal dwReserved As UInteger) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoDosDateTimeToFileTime Lib "ole32.dll" (ByVal nDosDate As UShort, ByVal nDosTime As UShort, <Out()> ByRef lpFileTime As FileTime) As Boolean
        Public Declare Function CoEnableCallCancellation Lib "ole32.dll" (ByVal pReserved As IntPtr) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoFileTimeNow Lib "ole32.dll" (<Out()> ByRef lpFileTime As FileTime) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoFileTimeToDosDateTime Lib "ole32.dll" (ByRef lpFileTime As FileTime, <Out()> ByRef lpDosDate As UShort, <Out()> ByRef lpDosTime As UShort) As Boolean
        Public Declare Sub CoFreeAllLibraries Lib "ole32.dll" ()
        Public Declare Sub CoFreeLibrary Lib "ole32.dll" (ByVal hInst As IntPtr)
        Public Declare Sub CoFreeUnusedLibraries Lib "ole32.dll" ()
        Public Declare Sub CoFreeUnusedLibrariesEx Lib "ole32.dll" (ByVal dwUnloadDelay As UInteger, ByVal dwReserved As UInteger)
        Public Declare Function CoGetApartmentType Lib "ole32.dll" (<Out()> ByRef pAptType As APTType, <Out()> ByRef pAptQualifier As APTTypeQualifier) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoGetCallContext Lib "ole32.dll" (ByRef riid As Guid, <MarshalAs(UnmanagedType.Interface), Out()> ByRef ppInterface As Object) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoGetCallerID Lib "ole32.dll" (<Out()> ByRef lpdwTID As IntPtr) As IntPtr
        Public Declare Function CoGetCancelObject Lib "ole32.dll" (ByVal dwThreadId As UInteger, ByRef iid As Guid, <MarshalAs(UnmanagedType.Interface), Out()> ByRef ppUnk As Object) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoGetClassObject Lib "ole32.dll" (ByRef rclsid As UInteger, ByVal dwClsContext As ClsCtx, ByVal pServerInfo As CoServerInfo, ByRef riid As Guid, <MarshalAs(UnmanagedType.Interface), Out()> ByRef ppv As Object) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoGetContextToken Lib "ole32.dll" (<Out()> ByRef pToken As ICOM.IObjContext) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoGetCurrentLogicalThreadId Lib "ole32.dll" (<Out()> ByRef pguid As Guid) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoGetCurrentProcess Lib "ole32.dll" () As UInteger
        Public Declare Function CoGetInstanceFromFile Lib "ole32.dll" (ByRef pServerInfo As CoServerInfo, ByRef pClsid As Guid, <MarshalAs(UnmanagedType.IUnknown)> ByRef punkOuter As Object, ByVal dwClsCtx As ClsCtx, ByVal grfMode As UInteger, <MarshalAs(UnmanagedType.LPStr)> ByVal pwszName As String, ByVal dwCount As UInteger, <MarshalAs(UnmanagedType.LPArray), Out()> ByRef pResults() As MultiQI) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoGetInstanceFromIStorage Lib "ole32.dll" (ByRef pServerInfo As CoServerInfo, ByRef pClsid As Guid, <MarshalAs(UnmanagedType.IUnknown)> ByRef punkOuter As Object, ByVal dwClsCtx As ClsCtx, <MarshalAs(UnmanagedType.Interface)> ByRef pstg As IOLE.IStorage, ByVal dwCount As UInteger, <MarshalAs(UnmanagedType.LPArray), Out()> ByRef pResults() As MultiQI) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoGetInterceptor Lib "ole32.dll" (ByRef iidIntercepted As Guid, <MarshalAs(UnmanagedType.IUnknown)> ByRef punkOuter As Object, ByRef iid As Guid, <MarshalAs(UnmanagedType.Interface), Out()> ByRef ppv As Object) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoGetInterfaceAndReleaseStream Lib "ole32.dll" (ByRef pStm As IOLE.IStream, ByRef iid As Guid, <MarshalAs(UnmanagedType.Interface), Out()> ByRef ppv As Object) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoGetMalloc Lib "ole32.dll" (ByVal dwMemContext As UInteger, <Out()> ByRef ppMalloc As ICOM.IMalloc) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoGetMarshalSizeMax Lib "ole32.dll" (<Out()> ByRef pulSize As UInteger, ByRef riid As Guid, <MarshalAs(UnmanagedType.IUnknown)> ByRef pUnk As Object, ByVal dwDestContext As MshCtx, ByVal pvDestContext As IntPtr, ByVal mshlflags As MshlFlags) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoGetObject Lib "ole32.dll" (<MarshalAs(UnmanagedType.LPWStr)> ByVal pszName As String, ByRef pBindOptions As BindOptions, ByRef riid As Guid, <Out(), MarshalAs(UnmanagedType.Interface)> ByRef ppv As Object) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoGetObjectContext Lib "ole32.dll" (ByRef riid As Int32, <Out(), MarshalAs(UnmanagedType.Interface)> ByRef ppv As Object) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoGetPSClsid Lib "ole32.dll" (ByRef riid As Guid, ByRef pClsid As Guid) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoGetStandardMarshal Lib "ole32.dll" (ByRef riid As Guid, <MarshalAs(UnmanagedType.IUnknown)> ByRef pUnk As Object, ByVal dwDestContext As MshCtx, ByVal pvDestContext As IntPtr, ByVal mshlflags As MshlFlags, <Out()> ByRef ppMarshal As ICOM.IMarshal) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoGetStdMarshalEx Lib "ole32.dll" (<MarshalAs(UnmanagedType.IUnknown)> ByRef pUnkOuter As Object, ByVal smexflags As StdMshFlags, <MarshalAs(UnmanagedType.IUnknown), Out()> ByRef ppUnkInner As Object) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoGetTreatAsClass Lib "ole32.dll" (ByRef clsidOld As Guid, <Out()> ByRef pClsidNew As Guid) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoImpersonateClient Lib "ole32.dll" () As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoInitialize Lib "ole32.dll" (ByVal pvReserved As IntPtr) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoInitializeEx Lib "ole32.dll" (ByVal pvReserved As IntPtr, ByVal dwCoInit As CoInit) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoInitializeSecurity Lib "ole32.dll" (ByRef pSecDesc As SecurityDescriptor, ByVal cAuthSvc As AuthenticationService, <MarshalAs(UnmanagedType.LPArray)> ByRef asAuthSvc() As SoleAuthenticationService, ByVal pReserved1 As IntPtr, ByVal dwAuthnLevel As AuthenticationLevel, ByVal dwImpLevel As ImpersonationLevel, ByRef pAuthList As SoleAuthenticationList, ByVal dwCapabilities As AuthenticationCapabilities, ByRef pReserved3 As IntPtr) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoInstall Lib "ole32.dll" (ByRef pbc As ICOM.IBindCtx, ByVal dwFlags As UInteger, ByRef pClassSpec As TySpec, ByRef pQuery As QueryContext, <MarshalAs(UnmanagedType.LPWStr)> ByVal pszCodeBase As String) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoInvalidateRemoteMachineBindings Lib "ole32.dll" (<MarshalAs(UnmanagedType.LPWStr)> ByVal pszMachineName As String) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoIsHandlerConnected Lib "ole32.dll" (<MarshalAs(UnmanagedType.IUnknown)> ByRef pUnk As Object) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoIsOle1Class Lib "ole32.dll" (ByRef rclsid As Guid) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoLoadLibrary Lib "ole32.dll" (<MarshalAs(UnmanagedType.LPWStr)> ByVal lpszLibName As String, <MarshalAs(UnmanagedType.Bool)> ByVal bAutoFree As Boolean) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoLockObjectExternal Lib "ole32.dll" (<MarshalAs(UnmanagedType.IUnknown)> ByRef pUnk As Object, <MarshalAs(UnmanagedType.Bool)> ByVal fLock As Boolean, <MarshalAs(UnmanagedType.Bool)> ByVal fLastUnlockReleases As Boolean) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoMarshalHresult Lib "ole32.dll" (ByRef pstm As IOLE.IStream, <MarshalAs(UnmanagedType.Error)> ByVal hresult As HResult) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoMarshalInterface Lib "ole32.dll" (ByRef pStm As OLE.IStream, ByRef riid As Guid, <MarshalAs(UnmanagedType.IUnknown)> ByRef pUnk As Object, ByVal dwDestContext As MshCtx, ByVal pvDestContext As IntPtr, ByVal mshlflags As MshlFlags) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoMarshalInterThreadInterfaceInStream Lib "ole32.dll" (ByRef riid As Guid, <MarshalAs(UnmanagedType.IUnknown)> ByRef pUnk As Object, <Out()> ByRef ppStm As IOLE.IStream) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoQueryAuthenticationServices Lib "ole32.dll" (<Out()> ByRef pcAuthSvc As UInteger, <Out()> ByRef asAuthSvc As SoleAuthenticationInfo) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoQueryClientBlanket Lib "ole32.dll" (<Out()> ByRef pAuthnSvc As AuthenticationService, <Out()> ByRef pAuthzSvc As AuthenticationService, <Out()> ByRef pServerPrincName As IntPtr, <Out()> ByRef pAuthnLevel As AuthenticationLevel, <Out()> ByRef pImpLevel As IntPtr, <Out()> ByRef pPrivs As IntPtr, ByRef pCapabilities As AuthenticationCapabilities) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoQueryProxyBlanket Lib "ole32.dll" (<MarshalAs(UnmanagedType.IUnknown)> ByRef pProxy As Object, <Out()> ByRef pwAuthnSvc As AuthenticationService, <Out()> ByRef pAuthzSvc As AuthenticationService, <Out()> ByRef pServerPrincName As IntPtr, <Out()> ByRef pAuthnLevel As AuthenticationLevel, <Out()> ByRef pImpLevel As ImpersonationLevel, <Out()> ByRef pAuthInfo As IntPtr, <Out()> ByRef pCapabilites As AuthenticationCapabilities) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoRegisterChannelHook Lib "ole32.dll" (ByRef riid As Guid, <Out()> ByRef pChannelHook As ICOM.IChannelHook) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoRegisterClassObject Lib "ole32.dll" (ByRef rclsid As Guid, <MarshalAs(UnmanagedType.IUnknown)> ByRef pUnk As Object, ByVal dwClsContext As ClsCtx, ByVal flags As RegCls, <Out()> ByRef lpdwRegister As UInteger) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoRegisterInitializeSpy Lib "ole32.dll" (ByRef pSpy As ICOM.IInitializeSpy, <Out()> ByRef puliCookie As ULong) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoRegisterMallocSpy Lib "ole32.dll" (ByRef pMallocSpy As COM.IMallocSpy) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoRegisterMessageFilter Lib "ole32.dll" (ByRef lpMessageFilter As ICOM.IMessageFilter, <Out()> ByRef lplpMessageFilter As ICOM.IMessageFilter) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoRegisterPSClsid Lib "ole32.dll" (ByRef riid As Guid, ByRef rclsid As Guid) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoRegisterSurrogate Lib "ole32.dll" (ByRef pSurrogate As ICOM.ISurrogate) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoReleaseMarshalData Lib "ole32.dll" (ByRef pStm As OLE.IStream) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoReleaseServerProcess Lib "ole32.dll" () As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoResumeClassObjects Lib "ole32.dll" () As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoRevertToSelf Lib "ole32.dll" () As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoRevokeClassObject Lib "ole32.dll" (ByVal dwRegister As UInteger) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoRevokeInitializeSpy Lib "ole32.dll" (ByVal uliCookie As ULong) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoRevokeMallocSpy Lib "ole32.dll" () As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoSetCancelObject Lib "ole32.dll" (<MarshalAs(UnmanagedType.IUnknown)> ByRef pUnk As Object) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoSetProxyBlanket Lib "ole32.dll" (<MarshalAs(UnmanagedType.IUnknown)> ByRef pProxy As Object, ByVal dwAuthnSvc As AuthenticationService, ByVal dwAuthzSvc As AuthenticationService, ByRef pServerPrincName As IntPtr, ByVal dwAuthnLevel As AuthenticationLevel, ByVal dwImpLevel As ImpersonationLevel, ByVal pAuthInfo As IntPtr, ByVal dwCapabilities As AuthenticationCapabilities) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoSuspendClassObjects Lib "ole32.dll" () As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoSwitchCallContext Lib "ole32.dll" (<MarshalAs(UnmanagedType.IUnknown)> ByRef pNewObject As Object, <MarshalAs(UnmanagedType.IUnknown), Out()> ByRef ppOldObject As Object) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoTaskMemAlloc Lib "ole32.dll" (ByVal cb As UInteger) As IntPtr
        Public Declare Sub CoTaskMemFree Lib "ole32.dll" (ByVal pv As IntPtr)
        Public Declare Function CoTaskMemRealloc Lib "ole32.dll" (ByVal pv As IntPtr, ByVal cb As UInteger) As IntPtr
        Public Declare Function CoTestCancel Lib "ole32.dll" () As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoTreatAsClass Lib "ole32.dll" (ByRef clsidOld As Guid, ByRef clsidNew As Guid) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoUninitialize Lib "ole32.dll" () As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoUnmarshalHresult Lib "ole32.dll" (ByRef pstm As IOLE.IStream, <MarshalAs(UnmanagedType.Error), Out()> ByRef phresult As HResult) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoUnmarshalInterface Lib "ole32.dll" (ByRef pStm As IOLE.IStream, ByRef riid As Guid, <Out(), MarshalAs(UnmanagedType.Interface)> ByRef ppv As Object) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CoWaitForMultipleHandles Lib "ole32.dll" (ByVal dwFlags As CoWaitFlags, ByVal dwTimeout As UInteger, ByVal cHandles As UInteger, <MarshalAs(UnmanagedType.LPArray)> ByRef pHandles() As IntPtr, <Out()> ByRef lpdwindex As UInteger) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CreateAntiMoniker Lib "ole32.dll" (<Out()> ByRef ppmk As ICOM.IMoniker) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CreateBindCtx Lib "ole32.dll" (ByVal reserved As UInteger, <Out()> ByRef ppbc As ICOM.IBindCtx) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CreateClassMoniker Lib "ole32.dll" (ByRef rclsid As Guid, <Out()> ByRef ppmk As ICOM.IMoniker) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CreateFileMoniker Lib "ole32.dll" (<MarshalAs(UnmanagedType.LPWStr)> ByVal lpszPathName As String, <Out()> ByRef ppmk As ICOM.IMoniker) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CreateGenericComposite Lib "ole32.dll" (ByRef pmkFirst As ICOM.IMoniker, ByRef pmkRest As ICOM.IMoniker, <Out()> ByRef ppmkComposite As ICOM.IMoniker) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CreateItemMoniker Lib "ole32.dll" (<MarshalAs(UnmanagedType.LPWStr)> ByVal lpszDelim As String, <MarshalAs(UnmanagedType.LPWStr)> ByVal lpszItem As String, <Out()> ByRef ppmk As ICOM.IMoniker) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CreateObjrefMoniker Lib "ole32.dll" (<MarshalAs(UnmanagedType.IUnknown)> ByRef punk As Object, <Out()> ByRef ppmk As ICOM.IMoniker) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function CreatePointerMoniker Lib "ole32.dll" (<MarshalAs(UnmanagedType.IUnknown)> ByRef punk As Object, <Out()> ByRef ppmk As ICOM.IMoniker) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function DllCanUnloadNow Lib "activeds.dll" () As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function DllGetClassObject Lib "activeds.dll" (ByRef rclsid As Guid, ByRef riid As Guid, <Out(), MarshalAs(UnmanagedType.Interface)> ByRef ppv As Object) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function DllRegisterServer Lib "activeds.dll" () As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function DllUnregisterServer Lib "activeds.dll" () As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function GetClassFile Lib "ole32.dll" (<MarshalAs(UnmanagedType.LPWStr)> ByVal szFilename As String, <Out()> ByRef pclsid As Guid) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function GetRunningObjectTable Lib "ole32.dll" (ByVal reserved As UInteger, <Out()> ByRef pprot As ICOM.IRunningObjectTable) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function IIDFromString Lib "ole32.dll" (<MarshalAs(UnmanagedType.LPWStr)> ByVal lpsz As String, <Out()> ByRef lpiid As Guid) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function IsAccelerator Lib "ole32.dll" (ByVal hAccel As IntPtr, ByVal cAccelEntries As Integer, ByRef lpMsg As Msg, <Out()> ByRef lpwCmd As UShort) As <MarshalAs(UnmanagedType.Bool)> Boolean
        Public Declare Function IsEqualCLSID Lib "ole32.dll" (ByRef rclsid1 As Guid, ByRef rclsid2 As Guid) As <MarshalAs(UnmanagedType.Bool)> Boolean
        Public Declare Function IsEqualGUID Lib "ole32.dll" (ByRef rguid1 As Guid, ByRef rguid2 As Guid) As <MarshalAs(UnmanagedType.Bool)> Boolean
        Public Declare Function IsEqualIID Lib "ole32.dll" (ByRef riid1 As Guid, ByRef riid2 As Guid) As <MarshalAs(UnmanagedType.Bool)> Boolean
        Public Declare Function MkParseDisplayName Lib "ole32.dll" (ByRef pbc As ICOM.IBindCtx, <MarshalAs(UnmanagedType.LPWStr)> ByVal szUserName As String, <Out()> ByRef pchEaten As UInteger, <Out()> ByRef ppmk As ICOM.IMoniker) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function MonikerCommonPrefixWith Lib "ole32.dll" (ByRef pmkThis As ICOM.IMoniker, ByRef pmkOther As ICOM.IMoniker, <Out()> ByRef ppmkCommon As ICOM.IMoniker) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function MonikerRelativePathTo Lib "ole32.dll" (ByRef pmkSrc As Int32, ByRef pmkDest As ICOM.IMoniker, <Out()> ByRef ppmkRelPath As ICOM.IMoniker, <MarshalAs(UnmanagedType.Bool)> ByVal dwReserved As Boolean) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function OleDoAutoConvert Lib "ole32.dll" (ByRef pStg As IOLE.IStorage, <Out()> ByRef pClsidNew As Guid) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function OleGetAutoConvert Lib "ole32.dll" (ByRef clsidOld As Guid, <Out()> ByRef pClsidNew As Guid) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function OleGetIconOfClass Lib "ole32.dll" (ByRef rclsid As Guid, <MarshalAs(UnmanagedType.LPWStr)> ByVal lpszLabel As String, <MarshalAs(UnmanagedType.Bool)> ByVal fUseTypeAsLabel As Boolean) As IntPtr
        Public Declare Function OleGetIconOfFile Lib "ole32.dll" (<MarshalAs(UnmanagedType.LPWStr)> ByVal lpszPath As String, <MarshalAs(UnmanagedType.Bool)> ByVal fUseFileAsLabel As Boolean) As IntPtr
        Public Declare Function OleIconToCursor Lib "oleaut32.dll" (ByVal hinstExe As IntPtr, ByVal hIcon As IntPtr) As IntPtr
        Public Declare Function OleRegGetMiscStatus Lib "ole32.dll" (ByRef clsid As Guid, ByVal dwAspect As DVAspect, <Out()> ByRef pdwStatus As UInteger) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function OleRegGetUserType Lib "ole32.dll" (ByRef clsid As Guid, ByVal dwFormOfType As UInteger, <Out(), MarshalAs(UnmanagedType.LPWStr)> ByRef pszUserType As String) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function OleSetAutoConvert Lib "ole32.dll" (ByRef clsidOld As Guid, ByRef clsidNew As Guid) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function ProgIDFromCLSID Lib "ole32.dll" (ByRef clsid As Guid, <Out(), MarshalAs(UnmanagedType.LPWStr)> ByRef lplpszProgID As String) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function StringFromCLSID Lib "ole32.dll" (ByRef rclsid As Guid, <Out(), MarshalAs(UnmanagedType.LPWStr)> ByRef lplpsz As String) As <MarshalAs(UnmanagedType.Error)> Integer
        Public Declare Function StringFromGUID2 Lib "ole32.dll" (ByRef rguid As Guid, <Out(), MarshalAs(UnmanagedType.LPWStr)> ByRef lpsz As String, ByRef cchMax As UInteger) As Integer

        Public Declare Function StringFromIID Lib "ole32.dll" (ByRef rclsid As Guid, <Out(), MarshalAs(UnmanagedType.LPWStr)> ByRef lplpsz As String) As <MarshalAs(UnmanagedType.Error)> Integer

        'Public Declare Function CreateAsyncBindCtx Lib "URLMON.dll" (ByVal Reserved As UInteger, ByRef pBSCb As IShell.IBindStatusCallback, ByRef pEFetc As IOLE.IEnumFORMATETC, <Out()> ByRef ppBC As ICOM.IBindCtx) As <MarshalAs(UnmanagedType.Error)> Integer
        'Public Declare Function CreateAsyncBindCtxEx Lib "URLMON.dll" (ByRef pbc As ICOM.IBindCtx, ByVal dwOptions As UInteger, ByRef pBSCb As IShell.IBindStatusCallback, ByRef pEnum As IOLE.IEnumFORMATETC, <Out()> ByRef ppBC As COM.IBindCtx, ByVal Reserved As UInteger) As <MarshalAs(UnmanagedType.Error)> Integer
    End Class

End Namespace
